using Basis;
using UnityEngine;
namespace NL.Advanced
{

    public class Raddar : TargetCollecter/*, IPropertyChild*/
    {
        public float Range;

        protected SphereCollider _SphereCollider;
        protected BoxCollider _BoxCollider;
        protected override void Awake()
        {
            base.Awake();
        }

        private void Start()
        {
            _BoxCollider = GetComponent<BoxCollider>();
            if (_BoxCollider == null)
            {
                _SphereCollider = gameObject.GETComponent<SphereCollider>();
                _SphereCollider.isTrigger = true;
            }
            else
            {
                _BoxCollider.isTrigger = true;
            }

            SetSize(Range);
        }

        public virtual void SetSize(float range)
        {
            Range = range;
            if (_SphereCollider != null)
            {
                _SphereCollider.radius = range;
            }
            if (_BoxCollider != null)
            {
                _BoxCollider.size += new Vector3(0, 0, range);
            }
        }

        //ICombatOwner Parent;
        //void IPropertyChild.OnProperty(Property property)
        //{

        //    Reset();
        //}

        //protected override  void Reset()
        //{
        //    if (Parent == null) Parent=GetComponentInParent<ICombatOwner>();

        //    if (Parent == null) return;

        //    Range = Parent.GenarateRange();

        //    base.Reset();

        //}


    }
}

